home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / A-B / AC&TF.cpt / •AC&TF• Edited / stack.txt < prev   
Text File  |  1992-03-21  |  8KB  |  240 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 4
  11. -- first background id: 2739
  12. -- card count: 306
  13. -- first card id: 68411
  14. -- list block id: 83162
  15. -- print block id: 70050
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 12
  19. -- free size: 16960 bytes
  20. -- total size: 98304 bytes
  21. -- stack block size: 7168 bytes
  22. -- created by hypercard version: 0x01228000
  23. -- compacted by hypercard version: 0x01228000
  24. -- modified by hypercard version: 0x01228000
  25. -- opened by hypercard version: 0x01228000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x8000000008000000
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0x5FAAEAAA5FAAEAAA
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0x005FAAAAEAAAAAAA
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. ----------------------------------------------------------------------
  69. PLEASE NOTE: This ‚ÄúAreaCODE&TIMEfinder‚Äù has been registered with the
  70. Register of Copyrights, Washington, D.C. by the Kinetic Press, 1991-2.
  71. ----------------------------------------------------------------------
  72.  
  73. -- This version last modified on 1/25/92
  74.  
  75. on openStack
  76.   if the version ‚â• 2 then
  77.     put the name of menuItem 6 of menu "File" into itemName
  78.     if the first word of itemName is "Convert" then
  79.       answer "This stack must be converted to work properly." && "Do you want to convert it now?" with "No" or "Yes"
  80.       if it is "Yes" then doMenu itemName
  81.     end if
  82.   end if
  83.  
  84.   go to card "Title Card"
  85.   put the short name of bg btn 1 of first card of bg "Main" into bname
  86.   if first word of bname is not "Your" then
  87.     answer "Welcome to the Area Codes stack!" with "OK"
  88.     send mouseup to button "Personalize"
  89.   end if
  90.  
  91.   DateChanged
  92. end openStack
  93.  
  94. on idle
  95.   put the long date into Today
  96.   if Today ‚↠field "LastDate" of card "Title Card" then DateChanged
  97.   pass idle
  98. end idle
  99.  
  100. on openCard
  101.   global DSTObservedThere
  102.  
  103.   -- if we are on one of the data cards, adjust the DST setting for the
  104.   -- place represented by this card
  105.   if the short name of this bg is "Main" then
  106.     put GetDSTObserved(bg field "Country Code", bg field "Area/City Code") into DSTObservedThere
  107.   end if
  108. end openCard
  109.  
  110.  
  111. ------------------------------------------------------------------
  112. -- Handler that is called on start or when the date changes
  113. -- It sets the global DSTSeason according to the current date
  114. ------------------------------------------------------------------
  115. on DateChanged
  116.   global DSTSeason
  117.  
  118.   put the long date into Today
  119.   put Today into field "LastDate" of card "Title Card"  -- store the date away
  120.   put word 1 of item 2 of Today into Month
  121.   if Month is in "May, June, July, August, September" then
  122.     put "DST" into DSTSeason   -- it's summer, turn on DST
  123.     exit DateChanged
  124.   else
  125.     if Month is in "November, December, January, February, March" then
  126.       put "NoDST" into DSTSeason  -- it's winter, no DST
  127.       exit DateChanged
  128.     end if
  129.   end if
  130.  
  131.   -- if we get this far, it is either April or October,
  132.   -- need to check in more detail
  133.   put item 1 of Today into Day
  134.   put word 2 of item 2 of Today into Date
  135.   if Month = "April" then
  136.     if Date > 7  then  -- after the switch to DST
  137.       put "DST" into DSTSeason
  138.       exit DateChanged
  139.     else
  140.       -- we're in the first week of April. Find out how many days
  141.       -- until the next Sunday
  142.       put DayToNum(Day) into DaysTilSunday
  143.       if DaysTilSunday = 0 then   -- Today is Sunday! DST in effect
  144.         put "DST" into DSTSeason
  145.         exit DateChanged
  146.       else   -- Figure out how many days left 'til the 7th
  147.         put 7 - Date into DaysLeft
  148.         if DaysLeft < DaysTilSunday then  -- must be past the first Sunday
  149.           put "DST" into DSTSeason
  150.         else  -- we are before the change
  151.           put "NoDST" into DSTSeason
  152.         end if
  153.         exit DateChanged
  154.       end if
  155.     end if
  156.   end if  -- End of April clause
  157.  
  158.   --
  159.   -- if we get this far, it is October
  160.   --
  161.  
  162.   if Date < 25  then  -- before the switch to NoDST
  163.     put "DST" into DSTSeason
  164.     exit DateChanged
  165.   else
  166.     -- we're in the last week of October. Find out how many days
  167.     -- until the next Sunday
  168.     put DayToNum(Day) into DaysTilSunday
  169.     if DaysTilSunday = 0 then   -- Today is Sunday! NoDST in effect
  170.       put "NoDST" into DSTSeason
  171.       exit DateChanged
  172.     else   -- Figure out how many days left 'til the 31st
  173.       put 31 - Date into DaysLeft
  174.       if DaysLeft < DaysTilSunday then  -- must be past the last Sunday
  175.         put "NoDST" into DSTSeason
  176.       else  -- we are before the change
  177.         put "DST" into DSTSeason
  178.       end if
  179.       exit DateChanged
  180.     end if
  181.   end if
  182.   put DSTSeason
  183. end DateChanged
  184.  
  185. -- This function converts the day of the week into
  186. -- the number of days until Sunday
  187. function DayToNum theDay
  188. if theDay = "Monday" then return 6
  189. if theDay = "Tuesday" then return 5
  190. if theDay = "Wednesday" then return 4
  191. if theDay = "Thursday" then return 3
  192. if theDay = "Friday" then return 2
  193. if theDay = "Saturday" then return 1
  194. if theDay = "Sunday" then return 0
  195. end DayToNum
  196.  
  197. -- This function is called when the user's Area Code
  198. -- changes.  It sets the Hidden fields "GMTHere" and "DSTObservedHere"
  199. -- on the Title card
  200. function AreaCodeChanged NewCode
  201. set lockScreen to true
  202. go to first card of bg "Main"
  203. find word NewCode in field "Area/City Code"
  204. if the result is empty then -- successful search
  205.   put field "GMTThere" into field "GMTHere" of card "Title Card"
  206.   put GetDSTObserved(bg field "Country Code", bg field "Area/City Code") into bg field "DSTObservedHere" of card "Title Card"
  207.   put true into rslt
  208. else
  209.   put false into rslt
  210. end if
  211. go back
  212. go back
  213. set lockScreen to false
  214. return rslt
  215. end AreaCodeChanged
  216.  
  217. function GetDSTObserved CountryCode, AreaCode
  218. -- if we are in the US or Canada, use area code to decide.
  219. if CountryCode is "1" then
  220.   if AreaCode is in "602,317,219,808,809" then
  221.     put "NoDST" into rslt
  222.   else
  223.     put "DST" into rslt
  224.   end if
  225.  
  226. else -- we are in another country, so use country code to decide.
  227.  
  228.   -- if the country code of this card is NOT in the list of
  229.   -- country codes that DO observe DST, then put "NoDST"...
  230.  
  231.   if CountryCode is not in "1,7,20,21,31,32,33,33,34,36,37,38,39,40,41"& "42,43,44,45,46,47,48,49,63,86,90,216,298"& "299,350,351,352,353,355,356,357,358,359,508"& "509,809,809,962,963,964,972" then
  232.     put "NoDST" into rslt
  233.   else
  234.     put "DST" into rslt
  235.   end if
  236. end if
  237. return rslt
  238. end GetDSTObserved
  239.  
  240.